using System;
using bitzhuwei.Compiler;

namespace bitzhuwei.AnsiCFormat {
    partial class CompilerAnsiC {

        public static class reservedWord {
            /// <summary>
            /// (
            /// </summary>
            public const string @LeftParenthesis符 = "(";
            /// <summary>
            /// )
            /// </summary>
            public const string @RightParenthesis符 = ")";
            /// <summary>
            /// .
            /// </summary>
            public const string @Dot符 = ".";
            /// <summary>
            /// ->
            /// </summary>
            public const string @Dash符RightAngle符 = "->";
            /// <summary>
            /// ++
            /// </summary>
            public const string @Plus符Plus符 = "++";
            /// <summary>
            /// --
            /// </summary>
            public const string @Dash符Dash符 = "--";
            /// <summary>
            /// ,
            /// </summary>
            public const string @Comma符 = ",";
            /// <summary>
            /// sizeof
            /// </summary>
            public const string @sizeof = "sizeof";
            /// <summary>
            /// &
            /// </summary>
            public const string @And符 = "&";
            /// <summary>
            /// *
            /// </summary>
            public const string @Asterisk符 = "*";
            /// <summary>
            /// +
            /// </summary>
            public const string @Plus符 = "+";
            /// <summary>
            /// -
            /// </summary>
            public const string @Dash符 = "-";
            /// <summary>
            /// ~
            /// </summary>
            public const string @Tilde符 = "~";
            /// <summary>
            /// !
            /// </summary>
            public const string @Bang符 = "!";
            /// <summary>
            /// /
            /// </summary>
            public const string @Slash符 = "/";
            /// <summary>
            /// %
            /// </summary>
            public const string @Percent符 = "%";
            /// <summary>
            /// <<
            /// </summary>
            public const string @LeftAngle符LeftAngle符 = "<<";
            /// <summary>
            /// >>
            /// </summary>
            public const string @RightAngle符RightAngle符 = ">>";
            /// <summary>
            /// <
            /// </summary>
            public const string @LeftAngle符 = "<";
            /// <summary>
            /// >
            /// </summary>
            public const string @RightAngle符 = ">";
            /// <summary>
            /// <=
            /// </summary>
            public const string @LeftAngle符Equal符 = "<=";
            /// <summary>
            /// >=
            /// </summary>
            public const string @RightAngle符Equal符 = ">=";
            /// <summary>
            /// ==
            /// </summary>
            public const string @Equal符Equal符 = "==";
            /// <summary>
            /// !=
            /// </summary>
            public const string @Bang符Equal符 = "!=";
            /// <summary>
            /// ^
            /// </summary>
            public const string @Caret符 = "^";
            /// <summary>
            /// |
            /// </summary>
            public const string @Pipe符 = "|";
            /// <summary>
            /// &&
            /// </summary>
            public const string @And符And符 = "&&";
            /// <summary>
            /// ||
            /// </summary>
            public const string @Pipe符Pipe符 = "||";
            /// <summary>
            /// ?
            /// </summary>
            public const string @Question符 = "?";
            /// <summary>
            /// :
            /// </summary>
            public const string @Colon符 = ":";
            /// <summary>
            /// =
            /// </summary>
            public const string @Equal符 = "=";
            /// <summary>
            /// *=
            /// </summary>
            public const string @Asterisk符Equal符 = "*=";
            /// <summary>
            /// /=
            /// </summary>
            public const string @Slash符Equal符 = "/=";
            /// <summary>
            /// %=
            /// </summary>
            public const string @Percent符Equal符 = "%=";
            /// <summary>
            /// +=
            /// </summary>
            public const string @Plus符Equal符 = "+=";
            /// <summary>
            /// -=
            /// </summary>
            public const string @Dash符Equal符 = "-=";
            /// <summary>
            /// <<=
            /// </summary>
            public const string @LeftAngle符LeftAngle符Equal符 = "<<=";
            /// <summary>
            /// >>=
            /// </summary>
            public const string @RightAngle符RightAngle符Equal符 = ">>=";
            /// <summary>
            /// &=
            /// </summary>
            public const string @And符Equal符 = "&=";
            /// <summary>
            /// ^=
            /// </summary>
            public const string @Caret符Equal符 = "^=";
            /// <summary>
            /// |=
            /// </summary>
            public const string @Pipe符Equal符 = "|=";
            /// <summary>
            /// ;
            /// </summary>
            public const string @Semicolon符 = ";";
            /// <summary>
            /// typedef
            /// </summary>
            public const string @typedef = "typedef";
            /// <summary>
            /// extern
            /// </summary>
            public const string @extern = "extern";
            /// <summary>
            /// static
            /// </summary>
            public const string @static = "static";
            /// <summary>
            /// auto
            /// </summary>
            public const string @auto = "auto";
            /// <summary>
            /// register
            /// </summary>
            public const string @register = "register";
            /// <summary>
            /// void
            /// </summary>
            public const string @void = "void";
            /// <summary>
            /// char
            /// </summary>
            public const string @char = "char";
            /// <summary>
            /// short
            /// </summary>
            public const string @short = "short";
            /// <summary>
            /// int
            /// </summary>
            public const string @int = "int";
            /// <summary>
            /// long
            /// </summary>
            public const string @long = "long";
            /// <summary>
            /// float
            /// </summary>
            public const string @float = "float";
            /// <summary>
            /// double
            /// </summary>
            public const string @double = "double";
            /// <summary>
            /// signed
            /// </summary>
            public const string @signed = "signed";
            /// <summary>
            /// unsigned
            /// </summary>
            public const string @unsigned = "unsigned";
            /// <summary>
            /// struct
            /// </summary>
            public const string @struct = "struct";
            /// <summary>
            /// union
            /// </summary>
            public const string @union = "union";
            /// <summary>
            /// enum
            /// </summary>
            public const string @enum = "enum";
            /// <summary>
            /// const
            /// </summary>
            public const string @const = "const";
            /// <summary>
            /// volatile
            /// </summary>
            public const string @volatile = "volatile";
            /// <summary>
            /// ...
            /// </summary>
            public const string @Dot符Dot符Dot符 = "...";
            /// <summary>
            /// case
            /// </summary>
            public const string @case = "case";
            /// <summary>
            /// default
            /// </summary>
            public const string @default = "default";
            /// <summary>
            /// if
            /// </summary>
            public const string @if = "if";
            /// <summary>
            /// else
            /// </summary>
            public const string @else = "else";
            /// <summary>
            /// switch
            /// </summary>
            public const string @switch = "switch";
            /// <summary>
            /// while
            /// </summary>
            public const string @while = "while";
            /// <summary>
            /// do
            /// </summary>
            public const string @do = "do";
            /// <summary>
            /// for
            /// </summary>
            public const string @for = "for";
            /// <summary>
            /// goto
            /// </summary>
            public const string @goto = "goto";
            /// <summary>
            /// continue
            /// </summary>
            public const string @continue = "continue";
            /// <summary>
            /// break
            /// </summary>
            public const string @break = "break";
            /// <summary>
            /// return
            /// </summary>
            public const string @return = "return";

        }

        /// <summary>
        /// if <paramref name="token"/> is a reserved word, assign correspond kind and return true.
        /// <para>otherwise, return false.</para>
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        private static bool CheckReservedWord(AnalyzingToken token) {
            bool isReservedWord = true;
            switch (token.value) {
            case reservedWord.@LeftParenthesis符: token.kind = st.@LeftParenthesis符; break;
            case reservedWord.@RightParenthesis符: token.kind = st.@RightParenthesis符; break;
            case reservedWord.@Dot符: token.kind = st.@Dot符; break;
            case reservedWord.@Dash符RightAngle符: token.kind = st.@Dash符RightAngle符; break;
            case reservedWord.@Plus符Plus符: token.kind = st.@Plus符Plus符; break;
            case reservedWord.@Dash符Dash符: token.kind = st.@Dash符Dash符; break;
            case reservedWord.@Comma符: token.kind = st.@Comma符; break;
            case reservedWord.@sizeof: token.kind = st.@sizeof; break;
            case reservedWord.@And符: token.kind = st.@And符; break;
            case reservedWord.@Asterisk符: token.kind = st.@Asterisk符; break;
            case reservedWord.@Plus符: token.kind = st.@Plus符; break;
            case reservedWord.@Dash符: token.kind = st.@Dash符; break;
            case reservedWord.@Tilde符: token.kind = st.@Tilde符; break;
            case reservedWord.@Bang符: token.kind = st.@Bang符; break;
            case reservedWord.@Slash符: token.kind = st.@Slash符; break;
            case reservedWord.@Percent符: token.kind = st.@Percent符; break;
            case reservedWord.@LeftAngle符LeftAngle符: token.kind = st.@LeftAngle符LeftAngle符; break;
            case reservedWord.@RightAngle符RightAngle符: token.kind = st.@RightAngle符RightAngle符; break;
            case reservedWord.@LeftAngle符: token.kind = st.@LeftAngle符; break;
            case reservedWord.@RightAngle符: token.kind = st.@RightAngle符; break;
            case reservedWord.@LeftAngle符Equal符: token.kind = st.@LeftAngle符Equal符; break;
            case reservedWord.@RightAngle符Equal符: token.kind = st.@RightAngle符Equal符; break;
            case reservedWord.@Equal符Equal符: token.kind = st.@Equal符Equal符; break;
            case reservedWord.@Bang符Equal符: token.kind = st.@Bang符Equal符; break;
            case reservedWord.@Caret符: token.kind = st.@Caret符; break;
            case reservedWord.@Pipe符: token.kind = st.@Pipe符; break;
            case reservedWord.@And符And符: token.kind = st.@And符And符; break;
            case reservedWord.@Pipe符Pipe符: token.kind = st.@Pipe符Pipe符; break;
            case reservedWord.@Question符: token.kind = st.@Question符; break;
            case reservedWord.@Colon符: token.kind = st.@Colon符; break;
            case reservedWord.@Equal符: token.kind = st.@Equal符; break;
            case reservedWord.@Asterisk符Equal符: token.kind = st.@Asterisk符Equal符; break;
            case reservedWord.@Slash符Equal符: token.kind = st.@Slash符Equal符; break;
            case reservedWord.@Percent符Equal符: token.kind = st.@Percent符Equal符; break;
            case reservedWord.@Plus符Equal符: token.kind = st.@Plus符Equal符; break;
            case reservedWord.@Dash符Equal符: token.kind = st.@Dash符Equal符; break;
            case reservedWord.@LeftAngle符LeftAngle符Equal符: token.kind = st.@LeftAngle符LeftAngle符Equal符; break;
            case reservedWord.@RightAngle符RightAngle符Equal符: token.kind = st.@RightAngle符RightAngle符Equal符; break;
            case reservedWord.@And符Equal符: token.kind = st.@And符Equal符; break;
            case reservedWord.@Caret符Equal符: token.kind = st.@Caret符Equal符; break;
            case reservedWord.@Pipe符Equal符: token.kind = st.@Pipe符Equal符; break;
            case reservedWord.@Semicolon符: token.kind = st.@Semicolon符; break;
            case reservedWord.@typedef: token.kind = st.@typedef; break;
            case reservedWord.@extern: token.kind = st.@extern; break;
            case reservedWord.@static: token.kind = st.@static; break;
            case reservedWord.@auto: token.kind = st.@auto; break;
            case reservedWord.@register: token.kind = st.@register; break;
            case reservedWord.@void: token.kind = st.@void; break;
            case reservedWord.@char: token.kind = st.@char; break;
            case reservedWord.@short: token.kind = st.@short; break;
            case reservedWord.@int: token.kind = st.@int; break;
            case reservedWord.@long: token.kind = st.@long; break;
            case reservedWord.@float: token.kind = st.@float; break;
            case reservedWord.@double: token.kind = st.@double; break;
            case reservedWord.@signed: token.kind = st.@signed; break;
            case reservedWord.@unsigned: token.kind = st.@unsigned; break;
            case reservedWord.@struct: token.kind = st.@struct; break;
            case reservedWord.@union: token.kind = st.@union; break;
            case reservedWord.@enum: token.kind = st.@enum; break;
            case reservedWord.@const: token.kind = st.@const; break;
            case reservedWord.@volatile: token.kind = st.@volatile; break;
            case reservedWord.@Dot符Dot符Dot符: token.kind = st.@Dot符Dot符Dot符; break;
            case reservedWord.@case: token.kind = st.@case; break;
            case reservedWord.@default: token.kind = st.@default; break;
            case reservedWord.@if: token.kind = st.@if; break;
            case reservedWord.@else: token.kind = st.@else; break;
            case reservedWord.@switch: token.kind = st.@switch; break;
            case reservedWord.@while: token.kind = st.@while; break;
            case reservedWord.@do: token.kind = st.@do; break;
            case reservedWord.@for: token.kind = st.@for; break;
            case reservedWord.@goto: token.kind = st.@goto; break;
            case reservedWord.@continue: token.kind = st.@continue; break;
            case reservedWord.@break: token.kind = st.@break; break;
            case reservedWord.@return: token.kind = st.@return; break;

            default: isReservedWord = false; break;
            }

            return isReservedWord;
        }
    }
}
